IdeaBlade DevForce 2010 Help Reference
SetterInterceptor Property
See Also  Example Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > DataEntityProperty<TInstance,TValue> Class : SetterInterceptor Property



The setter PropertyInterceptor.

Syntax

Example

C#Copy Code
public void Sample() {

  // Add a BeforeGet action to a GetterInterceptor:
  Employee.PropertyMetadata.Address.GetterInterceptor.AddAction(
    PropertyInterceptorTiming.Before,
    TraceGetter);

  // Add a BeforeSet action to a SetterInterceptor:
  Employee.PropertyMetadata.Country.SetterInterceptor.AddAction(
    PropertyInterceptorTiming.Before,
    TraceSetter);

  // Get/set a few properties
  DomainModelEntityManager mgr = new DomainModelEntityManager();
  Employee e = mgr.Employees.First();
  string addy = e.Address;
  e.Country = "UK";
}

public static void TraceGetter(IEntityPropertyGetInterceptorArgs args) {
  Console.WriteLine("getter called for " + args.EntityProperty.Name);
}

public static void TraceSetter(IEntityPropertySetInterceptorArgs args) {
  Console.WriteLine("setter called for " + args.EntityProperty.Name);
}

Remarks

Use the SetterInterceptor to add custom BeforeSet and AfterSet interception actions to a property setter.

Any registered OnBeforeSetTriggers and OnAfterSetTriggers verifiers will be executed based on the IdeaBlade.Validation.VerifierOptions.ExecutionModes in effect for the interceptor. This verification is done immediately before and after the value is stored in the backing field. BeforeSet actions will occur before OnBeforeSet verification and AfterSet actions will occur after OnAfterSet verification.

Will be null for a readonly property.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.